import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class Demo7 {

    public static void main(String[] args) {
        try(OutputStream outputStream = new FileOutputStream("./demo") ) {
            byte[] b = new byte[]{97,98,99,100,101,102};

            outputStream.write(b,0,b.length);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }


    public static void main2(String[] args) {

        try(OutputStream outputStream = new FileOutputStream("./demo")){
            byte[] b = new  byte[]{97,98,99};

            outputStream.write(b);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static void main1(String[] args) {

        try(OutputStream outputStream = new FileOutputStream("./demo",true)){
            outputStream.write(97);
            outputStream.write(98);
            outputStream.write(99);

            outputStream.write(100);
            outputStream.write(101);
            outputStream.write(102);

        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

